import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import Btn from './Btn';
import { useInstall } from '../context';
import '../global'
// 由于在global里面封装了AsyncStorage,所以引入了global,可以直接下面使用AsyncStorage而不用引入

const User = () => {
  const { setIsInstall } = useInstall();

  return (
    <View>
      <View style={styles.text}>
        <Text style={styles.user}>User</Text>
      </View>
      <View style={styles.btnBox}>
        <Btn
          style={styles.btn}
          font={{ color: '#fff', fontSize: 20 }}
          onPress={() => {
            setIsInstall(false);
            // AsyncStorage.removeItem('install');
            AsyncStorage.clear();
          }}
        >
          我要退出
        </Btn>
      </View>

    </View>

  )
}
const styles = StyleSheet.create({
  text: {
    alignItems: 'center',
    marginTop: 0.2 * h,
    height: 0.2 * h,
  },
  btnBox:{
    flex:1,
    alignItems:'center',
    justifyContent:'center'
  },
  btn: {
    backgroundColor: 'red',
    height: 0.05 * h,
    width: 0.3 * w,
    borderRadius: 15
  }
})
export default User;